import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

export type infoType = {

	id?: number,
	factoryName?: string,
	contactName?: string,
	contactPhone?: string,
	remark?: string,
}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/system/product/factory/v2/factories';
const Url = '/system/product/factory/v2/factory';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
};
export const addInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", Url, {
    data
  });
};
export const editInfo = (data?: object) => {
  return http.request<commonResult<any>>("put", Url, {
    data
  });
};
export const deleteInfo = (data?: object) => {
  return http.request<commonResult<any>>("delete", Url, {
    data
  });
};
/** 1.1.3.1选择厂家信息导出（包含产品类型信息） */ 
export const factoryexport = (data?: object) => {
  return http.request<commonResult<infoType>>("post", "/system/product/factory/v2/export", {
    data
  });
};
/** 1.1.3.2导入厂家信息（包含产品类型信息） */ 
export const factoryimportall = (data?: object) => {
  return http.request<commonResult<infoType>>("post", "/system/product/factory/v2/import", {
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};
